home *** CD-ROM | disk | FTP | other *** search
/ Aminet 16 / Aminet 16 (1996)(GTI - Schatztruhe)[!][Dec 1996].iso / Aminet / dev / src / wangisrc.lha / wangi / z / oldwp / Prefs / Library.PAS < prev    next >
Pascal/Delphi Source File  |  1995-01-05  |  3KB  |  97 lines

  1. Function Open_Libs;
  2.  
  3. begin
  4.     IntuitionBase := pIntuitionBase(OpenLibrary('intuition.library',36));
  5.     UtilityBase  := pUtilityBase(Openlibrary('utility.library',36));
  6.     GadToolsBase  := Openlibrary('gadtools.library',36);
  7.     AslBase  := Openlibrary('asl.library',36);
  8.     ReqToolsBase := pReqToolsBase(OpenLibrary(REQTOOLSNAME,38));
  9.     GfxBase := pGfxBase(OpenLibrary('graphics.library',34));
  10.     DatatypesBase  := Openlibrary('datatypes.library',39);
  11.     DiskFontBase := Openlibrary('diskfont.library',0);
  12.     IconBase := OpenLibrary('icon.library',0);
  13.     WorkbenchBase := OpenLibrary('workbench.library', 36);
  14.  
  15.     if (IntuitionBase <> NIL) and (UtilityBase <> NIL) and (GadToolsBase <> NIL) 
  16.         and (AslBase <> NIL) and (ReqToolsBase <> NIL) and (GfxBase <> NIL) 
  17.         and (DiskFontBase <> NIL) and (IconBase <> NIL) and (WorkbenchBase <> NIL) then 
  18.         Open_Libs := True
  19.     else
  20.         Open_Libs := False;
  21. end;
  22.  
  23. Procedure Close_Libs;
  24.  
  25. begin
  26.     if WorkbenchBase <> NIL then
  27.         CloseLibrary(pLibrary(WorkbenchBase));
  28.     if IconBase <> NIL then
  29.         CloseLibrary(pLibrary(IconBase));
  30.     if DiskFontBase <> NIL then
  31.         CloseLibrary(pLibrary(DiskFontBase));
  32.     if DataTypesBase <> NIL then
  33.         CloseLibrary(pLibrary(DataTypesBase));
  34.     if GfxBase <> NIL then
  35.         CloseLibrary(pLibrary(GfxBase));
  36.     if ReqToolsBase <> NIL then
  37.         CloseLibrary(pLibrary(ReqToolsBase));
  38.     if AslBase <> NIL then
  39.         CloseLibrary(pLibrary(AslBase));
  40.     if GadToolsBase <> NIL then
  41.         CloseLibrary(pLibrary(GadToolsBase));
  42.     if UtilityBase <> NIL then
  43.         CloseLibrary(pLibrary(UtilityBase));
  44.     if IntuitionBase <> NIL then
  45.         CloseLibrary(pLibrary(IntuitionBase));
  46. end;
  47.  
  48. function CStrConstPtrAR;
  49. type a = packed array [0..255] of char;
  50. var  p : ^a;
  51. begin
  52.   s := s + #0;                                    { Make "C" string }
  53.   p := AllocRemember(rk, length(s), MEMF_CLEAR);  { Get some mem for it }
  54.   move(s[1], p^, length(s));                      { Move s into newly alloc'd mem }
  55.   CStrConstPtrAR := p                               { Return the pointer }
  56. end;
  57.  
  58. Function Execsynch;
  59.  
  60. VAR
  61.     newcd   : BPTR;
  62.     oldcd   : BPTR;
  63.     t       : Array[0..6] of tTagItem;
  64.     outfile : BPTR;
  65.     rc, ok  : Boolean;
  66.  
  67. CONST
  68.     Out : String[5] = 'NIL:'#0;
  69.     
  70. Begin
  71.     rc := False;
  72.     { open IO file }
  73.     outfile := Open(@out[1], MODE_OLDFILE);
  74.     { Start program }
  75.     t[0].ti_Tag  := SYS_Asynch;
  76.     t[0].ti_Data := False_;
  77.     t[1].ti_Tag  := SYS_Input;
  78.     t[1].ti_Data := outfile;
  79.     t[2].ti_Tag  := SYS_Output;
  80.     t[2].ti_Data := 0;
  81.     t[3].ti_Tag  := TAG_END;
  82.     if SystemTagList(cmd,@t) = 0 then
  83.         rc := TRUE; { Program started! }
  84.     OK := AmigaDOS.Close_(outfile);
  85.     Execsynch := rc;
  86. End;
  87.  
  88. Function UpperStr;
  89. Var
  90.      X : Byte;
  91. Begin
  92.   For X := 1 To Length(S) Do
  93.     S[X] := UpCase(S[X]);
  94.   UpperStr := S;
  95. End;
  96.  
  97.